package com.ruoyi.warning.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.warning.domain.entity.Firewall;
import com.ruoyi.warning.domain.entity.FirewallLog;
import com.ruoyi.warning.mapper.FirewallLogMapper;
import com.ruoyi.warning.service.IFirewallLogService;
import com.ruoyi.warning.service.IFirewallService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 防火墙相关 服务实现类
 * </p>
 *
 * @author chenhc
 * @since 2025-07-24
 */
@Service
public class FirewallLogServiceImpl extends ServiceImpl<FirewallLogMapper, FirewallLog> implements IFirewallLogService {
    @Resource
    private IFirewallService firewallService;
    @Override
    public Object refresh() {
        //获取全部防火墙的hostname
        List<Firewall> firewallList = firewallService.list();
        //遍历每个防火墙，调用addFirewall方法
        for (Firewall firewall : firewallList) {
            firewallService.addFirewall(firewall.getHostname());
        }
        return "成功";
    }



}
